package com.ftg.selflearn.util;

import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 * @author Guo
 * @date 2022/4/27
 */
public class ResPageEntity extends ResEntity {

    /**
     * 当前页码
     */
    private Long page;

    /**
     * 多少条
     */
    private Long limit;

    /**
     * 总计多少页
     */
    private Long pages;
    /**
     * 共有多少数据
     */
    private Long count;

    public ResPageEntity(){}

    public ResPageEntity(IPage<?> ip){
        super(0,"success");
        this.setPage(ip.getCurrent());
        this.setLimit(ip.getSize());
        this.setCount(ip.getTotal());
        this.setPages(ip.getPages());
        this.setData(ip.getRecords());
    }

    public Long getPage() {
        return page;
    }

    public void setPage(Long page) {
        this.page = page;
    }

    public Long getLimit() {
        return limit;
    }

    public void setLimit(Long limit) {
        this.limit = limit;
    }

    public Long getPages() {
        return pages;
    }

    public void setPages(Long pages) {
        this.pages = pages;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }
}